package com.yunti.springboot.config.log;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.PrintWriter;
import java.io.StringWriter;

//异常类型------>java.lang.ArithmeticException: / by zero
//异常信息------>/ by zero
//异常跟踪栈------>java.lang.ArithmeticException: / by zero


@Data
@AllArgsConstructor
public class ExceptionApiLog {
    private String message;
    private String printStackTrace;


    public static String getExceptionSrintStackTrace(Exception e) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        return sw.toString();
    }
}
